package org.dochandler.esfinge.guardian.populator;

import java.util.Calendar;

import org.dochandler.service.domain.constants.Constants;
import org.dochandler.service.domain.mission.AccessTime;
import org.esfinge.guardian.annotation.config.PopulatorClass;
import org.esfinge.guardian.context.AuthorizationContext;
import org.esfinge.guardian.populator.Populator;

@PopulatorClass(AccessTimePopulator.class)
public class AccessTimePopulator implements Populator {

	@Override
	public void populate(AuthorizationContext context) {
		Calendar cal = Calendar.getInstance();
		AccessTime at = new AccessTime(
							cal.get( Calendar.HOUR_OF_DAY ), 
								cal.get( Calendar.MINUTE), 
									cal.get( Calendar.SECOND ) );
		
		context.getEnvironment().put(Constants.ACCESS_TIME, at);
		
	}

}
